<?php
namespace app\admin\controller;
class Apiconfig extends Base
{
    //短信配置
    public function lists(){
        if(is_post()){
            $d = $this->post;
            foreach ($d as $k => $v) {
                $this->db->update("api_config",['v'=>$v],['k = ?',[$k]]);
            }
            cookie('js_msg', '修改成功');
            cookie('js_function', 'reload');
            return suc();
        }
        $type = $this->get('type');
        if(empty($type)){
            $type = 'sms';
        }
        $list = $this->db->query('select * from api_config where uuid = ?',[$type]);
        $this->fetch(['list'=>$list,'type'=>$type]);
    }
}
